package lanqiao;

import java.util.Arrays;
import java.util.Scanner;

public class G2的 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] nk = Arrays.stream(sc.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
        int[] nums = Arrays.stream(sc.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
        System.out.println(getResult(nk,nums));
    }

    public static int getResult(int[] nk,int[] nums) {
        int n = nk[0],k=nk[1];
        int sum = 0;
        int count = 0;
        for (int num : nums) {
            int res = num;
            while(res%2==0) {
                count++;
                res = res/2;
            }
            if (res>1) {
                int x = res%2;
                sum+=2-x;

            }
        }
        return count>=k? sum:sum+k-count;
    }
}
